import http from "@/api";
import { Model, ResPage } from "@/api/interface";

// 获取模型列表
export const getDModelList = (params: Model.ReqModelParams) => {
  return http.post<ResPage<Model.ResModelList>>(`/python-api/query_model`, params);
};

// 获取模型实例列表
export const getModelIntanceList = (params) => {
  return http.post(`/python-api/query_modelId2modelIntances`, params);
};

// 增加模型
export const addModel = data => {
  return http.post("/python-api/add_model", data);
};

// 删除模型
export const deleteModel = (params: { id: string[] }) => {
  return http.post("/python-api/delete_model", params);
};

// 更改模型
export const updateModel = data => {
  return http.post("/python-api/update_model", data);
};

export const getDatasetList = (params) => {
  return http.post(`/python-api/query_dataset`,params);
};


export const addDataset = (params) => {
  return http.post(`/python-api/add_dataset`,params);
};

export const updateDatasetList = (params) => {
  return http.post(`/python-api/update_dataset`,params);
};
export const deleteDatasetList = (params) => {
  return http.post(`/python-api/delete_dataset`,params);
};


export const getParamList = (params) => {
  return http.post(`/python-api/query_param`,params);
};

export const addParam = (params) => {
  return http.post(`/python-api/add_param`,params);
};

export const updateParam = (params) => {
  return http.post(`/python-api/update_param`,params);
};
export const deleteParam= (params) => {
  return http.post(`/python-api/delete_param`,params);
};




//模型实例
export const getModelInstanceList = (params) => {
  return http.post(`/python-api/query_model_instance`,params);
};
export const addModelInstance = (params) => {
  return http.post(`/python-api/add_model_instance`,params);
};

export const updateModelInstance = (params) => {
  return http.post(`/python-api/update_model_instance`,params);
};
export const deleteModelInstance= (params) => {
  return http.post(`/python-api/delete_model_instance`,params);
};



//模型实例参数
export const getModelInstanceParamList = (params) => {
  return http.post(`/python-api/query_model_instance_param`,params);
};
export const addModelInstanceParam = (params) => {
  return http.post(`/python-api/add_model_instance_param`,params);
};

export const updateModelInstanceParam = (params) => {
  return http.post(`/python-api/update_model_instance_param`,params);
};
export const deleteModelInstanceParam= (params) => {
  return http.post(`/python-api/delete_model_instance_param`,params);
};

// 根据模型id查询模型实例
export const getQueryModelId2params = (params) => {
  return http.post(`/python-api/query_modelId2modelIntances`,params);
};

// 根据模型id查询模型参数
export const getQueryModelId2modelIntances = (params) => {
  return http.post(`/python-api/query_modelInstanceId2params`,params);
};

//根据数据集id查询数据集
export const queryDatasetByDatasetId = (params) => {
  return http.post(`/python-api/query_datasetId2datasetInfo`,params);
};

//查询全部数据集
export const queryDataset = (params) => {
  return http.post(`/python-api/query_dataset`,params);
};

// 获取诊断结果列表
export const queryDiagnoseResult = (params) => {
  return http.post<ResPage<Model.ResModelList>>(`/python-api/query_diagnose_result_info`, params);
};

// 删除导入诊断信息
export const deleteDiagnoseResult = (params) => {
  return http.post("/python-api/delete_diagnose_result", params);
};
// 获取实时诊断结果列表
export const queryRealDiagnoseResult = (params) => {
  return http.post<ResPage<Model.ResModelList>>(`/python-api/query_real_time_diagnose_alarm`, params);
};

// 删除实时诊断结果信息
export const deleteRealDiagnoseResult = (params) => {
  return http.post("/python-api/delete_real_time_diagnose_alarm", params);
};

// 删除实时诊断结果信息
export const doTrain = (params: { id: string[] }) => {
  return http.post("/python-api/do_train", params);
};


// 获取告警信息存入数组
export const queryAlarmNotification = (params) => {
  return http.post(`/python-api/query_alarm_notification`, params);
};

// 获取实时告警信息
export const queryalarmNotificationDetail = (params) => {
  return http.post<ResPage<Model.ResModelList>>(`/python-api/query_alarm_notification_detail`, params);
};

// 获取实时告警信息
export const updatealarmNotificationDetail = (params) => {
  return http.post<ResPage<Model.ResModelList>>(`/python-api/update_alarm_notification_state`, params);
};



// 上传文件开始诊断接口
export const uploadFileDiagnoseResult = (params) => {
  return http.post(`/python-api/do_diagnose`, params,{ headers: { 'Content-Type': 'multipart/form-data'}});
  // return http.post(`/python-api/do_diagnose`, params,);
};
